package chu.dejian.ui.activity;

import android.support.v4.app.Fragment;
import android.view.WindowManager;
import chu.dejian.alarm.MeasureAlarmListFragment;
import com.sam.blemodule.R;
import chu.dejian.ui.fragmet.AttentionFragment;
import chu.dejian.ui.fragmet.MeasureDeviceFragment;
import chu.dejian.ui.fragmet.MeasureFragment;
import chu.dejian.ui.fragmet.RecordChartFragment;
import com.sam.ui.base.activity.BaseFragmentActivity;
import com.sam.ui.base.fragment.InteractionFragment;
import com.sam.widget.nav_bar.NavigationBar;

public class BLEMainActivity extends BaseFragmentActivity implements InteractionFragment.OnFragmentInteractionListener/*, HscpFragment.DataExchanger*/{
	@Override
	protected void initPageInfo() {
		setStatusBarColor(getResources().getColor(R.color.main_blue_color));
		getWindow().setFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON,  WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON);
		NavigationBar.NavigationItemEntity[] navItems = {
				new NavigationBar.NavigationItemEntity(this,R.string.bottom_nav_measure,R.drawable.ic_bottombar_measure_out,R.drawable.ic_bottombar_measure_on),
				new NavigationBar.NavigationItemEntity(this,R.string.bottom_nav_record,R.drawable.ic_bottombar_record_out,R.drawable.ic_bottombar_record_on),
				new NavigationBar.NavigationItemEntity(this,R.string.bottom_nav_attention,R.drawable.ic_bottombar_see_out,R.drawable.ic_bottombar_see_on),
				new NavigationBar.NavigationItemEntity(this,R.string.bottom_nav_alarm,R.drawable.ic_bottombar_person_out,R.drawable.ic_bottombar_person_on)
		};
		Fragment[] fragments = {MeasureDeviceFragment.getInstance(),
//								MeasureFragment.getInstance(),
								RecordChartFragment.getInstance(),
								AttentionFragment.getInstance(),
								MeasureAlarmListFragment.getInstance()};
		setPageInfo(navItems,fragments,FRAGMENT_SWITCH_MODE.REPLACE,0);
		setNavigationBarAttrs(R.drawable.bottombar_bk,
				R.dimen.nav_bar_padding_top,
				R.dimen.nav_bar_padding_bottom,
				R.dimen.default_nav_item_name_icon_padding,
				R.color.gray_text_color,
				R.color.blue_text_color);
	}

	@Override
	public void onReplaceSelfWithFragment(Fragment fragment) {
//		showFragment(fragment,true);
		replaceFragment(fragment,true);
	}

	@Override
	public void onBackToPreviewFragment() {
		backPreviousFragment();
	}
}
